#include <stdio.h>
#include <string.h>
int x, y, z;
int s, n;
char str[5];

int main() {
    do{
        printf("Please enter the values of the three cards separated by spaces(Use 1 to 10) :\n");
        scanf("%d%d%d", &x, &y, &z);
        s = x + y + z;
        n = (x == 1) + (y == 1) + (z == 1);
        int tmp = (21 - s) / 10;
        if(tmp > n) tmp = n;
        s += tmp * 10;
        if(s <= 21) printf("The score of the three cards is %d\n", s);
        else printf("Invalid input\n");
        strcpy(str, "");
        do{
            printf(strlen(str) ? "Please input \"yes\" or \"no\"\n" : "Do you want to calcultate again?(input \"yes\" or \"no\")\n");
            scanf("%s", str);
        } while(strcmp(str, "yes") && strcmp(str, "no"));
        
    } while(!strcmp(str, "yes"));
    printf("Programme ended\n");
	return 0;
}